import frappe
from erpnext.controllers.status_updater import StatusUpdater

original_validate_qty = StatusUpdater.validate_qty

def light_mes_validate_qty(self):
    if self.doctype == "Purchase Invoice" and self.items[0].custom_job_card:
        pass
    else:
        original_validate_qty(self)


StatusUpdater.validate_qty = light_mes_validate_qty